﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="surSOMOCA.aspx.cs" Inherits="WebContratos.surSOMOCA" %>


<%@ Register Assembly="DevExpress.Web.ASPxEditors.v10.2, Version=10.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxEditors" TagPrefix="dx" %>

<%@ Register Assembly="DevExpress.Web.ASPxHtmlEditor.v10.2, Version=10.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxHtmlEditor" TagPrefix="dx" %>

<%@ Register assembly="DevExpress.Web.ASPxGridView.v10.2, Version=10.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxGridView" tagprefix="dx" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>Página sin título</title>
    
     <script type="text/javascript">
    // <![CDATA[
        function OnCommandExecute(s, e) {
            var value = e.parameter;
            switch (e.commandName) {
                case "InsertSmiley":
                    InsertSmiley(value);
                    break;
                case "InsertSpecialSymbol":
                    InsertSpecialSymbol(value);
                    break;
            }
        }
        function InsertSmiley(value) {
            var selection = HtmlEditor.GetSelection();
            var valueInfo = value.split("#");
            selection.SetHtml("<img style='margin-bottom:-2px;' src='../Content/Smilies/" + valueInfo[0] + ".png' alt='" + valueInfo[2] + "' title='" + valueInfo[1] + "' />");
        }
        function InsertSpecialSymbol(symbol) {
            var selection = HtmlEditor.GetSelection();
            selection.SetHtml(symbol);
        }
        
        function abrirPopup(c_campo1, c_campo2, valor)
		{
            
           
		  campo1 = document.getElementById(c_campo1).value;
		  campo2 = document.getElementById(c_campo2).value;
		 
		  nomCampo1 = c_campo1;		  
		  nomCampo2 = c_campo2;
		  
		  var longiBusc = 0;
		  var longiBusc1 = 0;
		  
		  if(valor==1)
		  {
		    obtieneListaValores(campo1, campo2, 'consultaEmpleados');			
		  }
		}
        
        var obj;
              function getXMLHTTPRequest() 
              {
                 var xRequest=null;
                if (window.XMLHttpRequest) {
                xRequest=new XMLHttpRequest();
                }else if (typeof ActiveXObject != "undefined"){
                  xRequest=new ActiveXObject("Microsoft.XMLHTTP");
                }
                  return xRequest;
                }
            function obtieneListaValores(campo1, campo2, campo3)
            {
                obj=getXMLHTTPRequest();
                if(obj!=null)
                {
                    obj.onreadystatechange = ProcessResponse;
                    obj.open("GET", "Srvlets/ProcessedPage.aspx?campo1="+campo1+"&campo2="+campo2+"&campo3="+campo3,  true);
                    obj.send(null);         
                }
                return false;
            }

            function ProcessResponse()
            {
                var basePath = "";
                
                if(obj.readyState == 4)
                {
                    if(obj.status == 200)
                    {
                        var retval=obj.responseText;  
                        
                        window.open(basePath+'General/encontrarDatos.aspx?exP='+navigator.appName.indexOf("Microsoft")+'&nomCampo1='+nomCampo1+'&nomCampo2='+nomCampo2+'&tipo=1','Consulta','width=590px,height=300px');

                    }
                    else
                    {
                        alert("Error retrieving data!" );
                    }   
                }
            }
            
    // ]]> 
    </script>



    <style type="text/css">
        .style1
        {
            text-align: right;
        }
        .style2
        {
        }
        .style3
        {
            width: 131px;
        }
        .style4
        {
            width: 169px;
        }
        .style5
        {
            width: 122px;
        }
        .style6
        {
            width: 118px;
        }
    </style>


<style type="text/css">
                
                    .style6{ 
                font-size:11px; font:Tahoma;
                }

                .cajaTexto
                {
                font-size:11px; font:Tahoma;
                border-left:#6699CC 1px solid; border-bottom:#4167B0 1px solid;
                border-right:#6699CC 1px solid; border-top:#4167B0 1px solid;  
                }

                #Dgradiente {

	                background-image: -webkit-gradient(linear,left bottom,left top,color-stop(0, #CEDCF8),color-stop(1, #E5EEFC));
	                }
       
	         .btnCrm
	         { width:84px; height:22px; 
	           border-left:#6699CC thin solid; border-bottom:#4167B0 thin solid;
	           border-right:#6699CC thin solid; border-top:#4167B0 thin solid; 
	               font-size: 11px;
                background-image: -webkit-gradient(linear,left bottom,left top,color-stop(0, #D0E5F7),color-stop(1, #B9D5EF));
            }
        	 
	         #button:active { 
	        position:relative; 
	        top:1px /* or more */ 
	        } 
            
            .Estilo3 {color: #000000; font-size: 11px; }
        
        </style>
        
        <script type="text/javascript" src="js/calendario/calendar.js"></script>
	<script type="text/javascript" src="js/calendario/calendar-en.js"></script>
	<script type="text/javascript" src="js/deluxe/dpopupwindow.js"></script>
	<script type="text/javascript" src="js/deluxe/deluxe-popup-window.js"></script>
	<script type="text/javascript" src="js/FormatValor.js"> </script>
	
	    <link rel="stylesheet" type="text/css" media="all" href="css/calendario/themeBlue.css" title="Aqua"/>
	<link rel="alternate stylesheet" type="text/css" media="all" href="css/calendario/theme(1)Blue.css" title="Tiger"/>


	<script type="text/javascript">
		
		var oldLink = null;
		
		function setActiveStyleSheet(link, title) 
		{
		  var i, a, main;
		  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
			if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
			  a.disabled = true;
			  if(a.getAttribute("title") == title) a.disabled = false;
			}
		  }
		  if (oldLink) oldLink.style.fontWeight = 'normal';
		  oldLink = link;
		  link.style.fontWeight = 'bold';
		  return false;
	    }

		function selected(cal, date) {
			  cal.sel.value = date; // just update the date in the input field.
			  if (cal.dateClicked && (cal.sel.id == "sel1" || cal.sel.id == "sel3"))
				// if we add this call we close the calendar on single-click.
				// just to exemplify both cases, we are using this only for the 1st
				// and the 3rd field, while 2nd and 4th will still require double-click.
				cal.callCloseHandler();
		}

		function closeHandler(cal) {
			  cal.hide();                        // hide the calendar
			//  cal.destroy();
			  _dynarch_popupCalendar = null;
		}
            
        
        function showCalendarControl(id, idImage, format, showsTime, showsOtherMonths) 
        {
			  var el = dg.GetEditFormElement('dg1',id);
			  var idIma = dg.GetEditFormElement('dg1',idImage);

			  if (_dynarch_popupCalendar != null) {
				// we already have some calendar created
				_dynarch_popupCalendar.hide();                 // so we hide it first.
			  } else {
				// first-time call, create the calendar.
				var cal = new Calendar(1, null, selected, closeHandler);
				// uncomment the following line to hide the week numbers
				// cal.weekNumbers = false;
				if (typeof showsTime == "string") {
				  cal.showsTime = true;
				  cal.time24 = (showsTime == "24");
				}
				if (showsOtherMonths) {
				  cal.showsOtherMonths = true;
				}
				_dynarch_popupCalendar = cal;                  // remember it in the global var
				cal.setRange(1900, 2070);        // min/max year allowed.
				cal.create();
			  }
			  _dynarch_popupCalendar.setDateFormat(format);    // set the specified date format
			  
			 // alert(el);
			  
			  _dynarch_popupCalendar.parseDate(el.value);      // try to parse the text in field
			  _dynarch_popupCalendar.sel = el;                 // inform it what input field we use

			  // the reference element that we pass to showAtElement is the button that
			  // triggers the calendar.  In this example we align the calendar bottom-right
			  // to the button.
			  _dynarch_popupCalendar.showAtElement(idIma, "Br");//(el.nextSibling, "Br");        // show the calendar

			  return false;
		}
            
			function showCalendar(id, idImage, format, showsTime, showsOtherMonths) {
			  var el = document.getElementById(id);
			  var idIma = document.getElementById(idImage);

			  if (_dynarch_popupCalendar != null) {
				// we already have some calendar created
				_dynarch_popupCalendar.hide();                 // so we hide it first.
			  } else {
				// first-time call, create the calendar.
				var cal = new Calendar(1, null, selected, closeHandler);
				// uncomment the following line to hide the week numbers
				// cal.weekNumbers = false;
				if (typeof showsTime == "string") {
				  cal.showsTime = true;
				  cal.time24 = (showsTime == "24");
				}
				if (showsOtherMonths) {
				  cal.showsOtherMonths = true;
				}
				_dynarch_popupCalendar = cal;                  // remember it in the global var
				cal.setRange(1900, 2070);        // min/max year allowed.
				cal.create();
			  }
			  _dynarch_popupCalendar.setDateFormat(format);    // set the specified date format
			  
			 // alert(el);
			  
			  _dynarch_popupCalendar.parseDate(el.value);      // try to parse the text in field
			  _dynarch_popupCalendar.sel = el;                 // inform it what input field we use

			  // the reference element that we pass to showAtElement is the button that
			  // triggers the calendar.  In this example we align the calendar bottom-right
			  // to the button.
			  _dynarch_popupCalendar.showAtElement(idIma, "Br");//(el.nextSibling, "Br");        // show the calendar

			  return false;
			}

			var MINUTE = 60 * 1000;
			var HOUR = 60 * MINUTE;
			var DAY = 24 * HOUR;
			var WEEK = 7 * DAY;

			// If this handler returns true then the "date" given as
			// parameter will be disabled.  In this example we enable
			// only days within a range of 10 days from the current
			// date.
			// You can use the functions date.getFullYear() -- returns the year
			// as 4 digit number, date.getMonth() -- returns the month as 0..11,
			// and date.getDate() -- returns the date of the month as 1..31, to
			// make heavy calculations here.  However, beware that this function
			// should be very fast, as it is called for each day in a month when
			// the calendar is (re)constructed.
			function isDisabled(date) {
			  var today = new Date();
			  return (Math.abs(date.getTime() - today.getTime()) / DAY) > 10;
			}

			function flatSelected(cal, date) {
			  var el = document.getElementById("preview");
			  el.innerHTML = date;
			}

			function showFlatCalendar() {
			  var parent = document.getElementById("display");

			  // construct a calendar giving only the "selected" handler.
			  var cal = new Calendar(0, null, flatSelected);



			  // hide week numbers
			  cal.weekNumbers = false;

			  // We want some dates to be disabled; see function isDisabled above
			  cal.setDisabledHandler(isDisabled);
			  cal.setDateFormat("%A, %B %e");

			  // this call must be the last as it might use data initialized above; if
			  // we specify a parent, as opposite to the "showCalendar" function above,
			  // then we create a flat calendar -- not popup.  Hidden, though, but...
			  cal.create(parent);

			  // ... we can show it here.
			  cal.show();
			}
	
	
	    function abrirPopup(c_campo1, c_campo2, valor)
		{
            
           
		  campo1 = document.getElementById(c_campo1).value;
		  campo2 = document.getElementById(c_campo2).value;
		 
		  nomCampo1 = c_campo1;		  
		  nomCampo2 = c_campo2;
		  
		  var longiBusc = 0;
		  var longiBusc1 = 0;
		  
		  if(valor==1)
		  {
		   
		    obtieneListaValores(campo1, campo2, 'consultaContra');
			
		  }else if(valor==3)
		  {
		    obtieneListaValores(campo1, campo2, 'consultaFiscalizador');
		    
		  }else if(valor==2)
		  {
		    obtieneListaValores(campo1, campo2, 'consultaAdministrador');
		    
		  }else if(valor==4)
		  {
		  obtieneListaValores(campo1, campo2, 'consultaGerencia');
			
		  }
		}
        
        var obj;
              function getXMLHTTPRequest() 
              {
                 var xRequest=null;
                if (window.XMLHttpRequest) {
                xRequest=new XMLHttpRequest();
                }else if (typeof ActiveXObject != "undefined"){
                  xRequest=new ActiveXObject("Microsoft.XMLHTTP");
                }
                  return xRequest;
                }
            function obtieneListaValores(campo1, campo2, campo3)
            {
                obj=getXMLHTTPRequest();
                if(obj!=null)
                {
                    obj.onreadystatechange = ProcessResponse;
                    obj.open("GET", "Srvlets/ProcessedPage.aspx?campo1="+campo1+"&campo2="+campo2+"&campo3="+campo3,  true);
                    obj.send(null);         
                }
                return false;
            }

            function ProcessResponse()
            {
                var basePath = "";
                
                if(obj.readyState == 4)
                {
                    if(obj.status == 200)
                    {
                        var retval=obj.responseText;  
                        
                        window.open(basePath+'General/encontrarDatos.aspx?exP='+navigator.appName.indexOf("Microsoft")+'&nomCampo1='+nomCampo1+'&nomCampo2='+nomCampo2,'Consulta','width=590px,height=300px');

                    }
                    else
                    {
                        alert("Error retrieving data!" );
                    }   
                }
            }
            
	</script>
	
        
    </head>
<body bgcolor="#D6E8FF">
    <form id="form1" runat="server">
    <div>
       <table style="width:100%"  summary="Submitted table designs" cellSpacing=0 cols=0 cellPadding=0>
			    <tr>
				<td style="width:1%"  align="left">
					<div style="height: 35px; font-weight: bold; font-size: 18px; color: #6699cc; font-family: Tahoma;">
						  <img src="images/ico_lrg_112.gif" 
							   loop="0"/>
					</div>
				 </td>
				 <td align="left" valign="bottom" style="width:80%">
                     <asp:Label ID="lblTitulo" runat="server" 
                         style="font-weight: 700; font-family: Arial, Helvetica, sans-serif; font-size: medium" 
                         Text="Cuadro de Descripcion y Calificacion de Compañias"></asp:Label>
                        </td>				
				 </tr>
   </table>

<table bgcolor="#EAF3FF"  
                       style=" width: 100%; height:100%; 
                        	  font-size: 11px; font-family: Tahoma; border-right: #b0c2d0 1px solid;
            				  border-top: #b0c2d0 1px solid; border-left: #b0c2d0 1px solid; border-bottom:#b0c2d0 1px solid; " id="idToolbar">
                  <tr style="height: 100%; width:100%">
                    <td
                        nowrap="nowrap" style="padding-right: 2px; padding-left: 5px; height: 30px;">
						<table style="width:100%;">
                            <tr>
                                <td class="style6">
                                    Fecha desde:</td>
                                <td class="style4">
                                    <asp:TextBox ID="txtFechaIni" runat="server" 
                                        CssClass="cajaTexto" EnableTheming="True"></asp:TextBox>
                                        
                                        <IMG style="cursor:pointer;"
            id="txtFechaSuscripcion02" border=0 alt="Calendario" width="16px" height="16px"
            src="images/calendar.png" onclick="return showCalendar(&#39;txtFechaIni&#39;,&#39;txtFechaSuscripcion02&#39;, &#39;%d/%m/%Y&#39;, &#39;24&#39;, true);"><span class="style6">DD/MM/YYYY</span>
                                </td>
                                <td>
                                </td>
                                <td class="style3">
                                    Fecha Hasta:</td>
                                <td>
                                    <asp:TextBox ID="txtFechaFin" runat="server" 
                                        CssClass="cajaTexto"></asp:TextBox>
                                        
                                        <IMG style="cursor:pointer;"
            id="IMG1" border=0 alt="Calendario" width="16px" height="16px"
            src="images/calendar.png" onclick="return showCalendar(&#39;txtFechaFin&#39;,&#39;IMG1&#39;, &#39;%d/%m/%Y&#39;, &#39;24&#39;, true);"><span class="style6">DD/MM/YYYY</span>
                                </td>
                            </tr>
                            <tr>
                                <td class="style6">
                                    Contratista:</td>
                                <td class="style2" colspan="3">
                                    <table style="width:100%;">
                                        <tr>
                                            <td class="style5">
                                                <asp:TextBox ID="txtContra" runat="server" CssClass="cajaTexto"></asp:TextBox>
                                            </td>
                                            <td>
                                                <asp:TextBox ID="txtDesContra" runat="server" Width="251px" 
                                                    CssClass="cajaTexto"></asp:TextBox>
                                            </td>
                                            <td>
                                                <asp:ImageButton runat="server" CausesValidation="False" 
    OnClientClick="abrirPopup('txtContra','txtDesContra',1);return false;" 
    Height="16px" Width="16px" ID="ImageButton4" 
    ImageUrl="images/ico_18_126.gif" ></asp:ImageButton></td>
                                              </tr>
                                          </table>
                                      </td>
                                  </tr>
                                  <tr>
                                      <td class="style1" colspan="4">
                                          <asp:Button ID="btnConsulta" runat="server" Text="Consultar" 
                                              style="text-align: right" onclick="btnConsulta_Click" CssClass="btnCrm" />
                                      </td>
                                  </tr>
                                  <tr>
                                      <td colspan="4" style="text-align: center">
                                          <asp:Label ID="lblContratista" runat="server" 
                                              style="text-align: center; font-weight: 700; font-size: 15px;"></asp:Label>
                                      </td>
                                  </tr>
                                  <tr>
                                      <td colspan="5">
                                          <asp:GridView ID="grdcontratos" runat="server" AutoGenerateColumns="False" 
                                              BackColor="#3382D4" BorderColor="#3382D4" BorderStyle="None" BorderWidth="1px" 
                                              CellPadding="3" PageSize="30" Width="100%">
                                              <FooterStyle BackColor="#CCCCCC" ForeColor="Black" />
                                              <RowStyle BackColor="#EEEEEE" ForeColor="Black" />
                                              <Columns>
                                                  <asp:TemplateField>
                                                      <HeaderTemplate>
                                                          Fecha:
                                                      </HeaderTemplate>
                                                      <ItemTemplate>
                                                          <%#Eval("FechaMes")%>
                                                      </ItemTemplate>
                                                  </asp:TemplateField>                                                 
                                                  <asp:TemplateField>
                                                      <HeaderTemplate>
                                                          Cortes Generados:
                                                      </HeaderTemplate>
                                                      <ItemTemplate>
                                                          <%#Eval("CortesGene")%>
                                                      </ItemTemplate>
                                                      <ItemStyle HorizontalAlign="Right" />
                                                  </asp:TemplateField>
                                                  <asp:TemplateField>
                                                      <HeaderTemplate>
                                                          Cortes Motivados:
                                                      </HeaderTemplate>
                                                      <ItemTemplate>
                                                          <%#Eval("CortesMat")%>
                                                      </ItemTemplate>
                                                      <ItemStyle HorizontalAlign="Right" />
                                                  </asp:TemplateField>
                                                  
                                                  <asp:TemplateField>
                                                      <HeaderTemplate>
                                                          % Cortes Motivados:
                                                      </HeaderTemplate>
                                                      <ItemTemplate>
                                                          <%#Eval("PorceCortesMat")%>
                                                      </ItemTemplate>
                                                      <ItemStyle HorizontalAlign="Right" />
                                                  </asp:TemplateField>
                                                  
                                                  <asp:TemplateField>
                                                      <HeaderTemplate>
                                                          Cortes Netos:
                                                      </HeaderTemplate>
                                                      <ItemTemplate>
                                                          <%#Eval("CortesNeto")%>
                                                      </ItemTemplate>
                                                      <ItemStyle HorizontalAlign="Right" />
                                                  </asp:TemplateField>
                                                  
                                                  <asp:TemplateField>
                                                      <HeaderTemplate>
                                                          % Cortes Netos:
                                                      </HeaderTemplate>
                                                      <ItemTemplate>
                                                          <%#Eval("PorceCortesNetos")%>
                                                      </ItemTemplate>
                                                      <ItemStyle HorizontalAlign="Right" />
                                                  </asp:TemplateField>
                                                  
                                                  <asp:TemplateField>
                                                      <HeaderTemplate>
                                                          Reconexiones Generados:
                                                      </HeaderTemplate>
                                                      <ItemTemplate>
                                                          <%#Eval("RecoGenera")%>
                                                      </ItemTemplate>
                                                      <ItemStyle HorizontalAlign="Right" />
                                                  </asp:TemplateField>
                                                  
                                                  
                                                  
                                                  <asp:TemplateField>
                                                      <HeaderTemplate>
                                                          Reconexiones Netos:
                                                      </HeaderTemplate>
                                                      <ItemTemplate>
                                                          <%#Eval("RecoNetos")%>
                                                      </ItemTemplate>
                                                      <ItemStyle HorizontalAlign="Right" />
                                                  </asp:TemplateField>
                                                  
                                                  <asp:TemplateField>
                                                      <HeaderTemplate>
                                                          % Reconexiones Netos:
                                                      </HeaderTemplate>
                                                      <ItemTemplate>
                                                          <%#Eval("PorceRecoNetos")%>
                                                      </ItemTemplate>
                                                      <ItemStyle HorizontalAlign="Right" />
                                                  </asp:TemplateField>
                                                  
                                                  <asp:TemplateField>
                                                      <HeaderTemplate>
                                                          % Reconexiones vs Cortes:
                                                      </HeaderTemplate>
                                                      <ItemTemplate>
                                                          <%#Eval("PorceRecoCortes")%>
                                                      </ItemTemplate>
                                                      <ItemStyle HorizontalAlign="Right" />
                                                  </asp:TemplateField>
                                                  
                                                  
                                              </Columns>
                                              <PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
                                              <SelectedRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" />
                                              <HeaderStyle BackColor="#3382D4" Font-Bold="True" ForeColor="White" />
                                              <AlternatingRowStyle BackColor="Gainsboro" />
                                          </asp:GridView>
                                      </td>
                                  </tr>
                                  <tr>
                                    <td colspan="5">
                                        <input id="btnImprimir" class="btnCrm" type="button" value="Imprimir" onclick="window.print();" /><br />
                                        
                                    </td>
                                  </tr>
                              </table>
                    
                    </td>
                    </tr>
        </table>
    
    </div>
    </form>
</body>
</html>

